package com.mdxq.mall.response;

import lombok.Data;

@Data
public class R {
    private int code;
    private String message;
    private Object Data;

    private R() {
    }
    //不允许通过构造器实例化R
    private R(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        Data = data;
    }

    public static R ok(Object data) {
        R r = new R(200, "操作成功", data);
        return r;
    }

    public static R error() {
        R r = new R(500, "操作失败", null);
        return r;
    }
}
